test(perf): add e2e perf tests for balanced consolidation - #3247
Draft
nathangeology wants to merge 3 commits into
Draft
test(perf): add e2e perf tests for balanced consolidation#3247nathangeology wants to merge 3 commits into
nathangeology wants to merge 3 commits into
Conversation
Introduce common.LatencyHarness alongside KarpenterMetricsPoller. The harness scrapes /metrics at phase start and stop, then reduces per-series histogram bucket deltas into percentile stats (P50/P90/P95/P99, plus bucket truncation rate) and counter deltas over the observation window. The scrape helper is shared with KarpenterMetricsPoller (previously the poller inlined the API-server pod-proxy fetch + parse). Both callers now funnel through scrapeKarpenterMetricFamilies. Includes common.LatencySidecar (JSON schema for the artifact written alongside PerformanceReport when OUTPUT_DIR is set) and common.WriteLatencySidecar so performance-suite specs share one on-disk shape rather than each declaring its own. Signed-off-by: Nathaniel Jones <jonesflp@amazon.com>
Adds test/suites/performance/balanced_baseline_marginal_test.go with: - Balanced Baseline It: same 1000-pod / 700-pod fixture as basic_test.go, wrapped with LatencyHarness so hero histograms (scheduling_decision, voluntary_disruption_decision_evaluation, pods_bound) are captured for both scale-out and consolidation phases. Reference latency distribution the marginal runs compare against; suite-wide default policy WhenEmptyOrUnderutilized applies. - Balanced Marginal Move: two variants share the same fixture; the small deployment's pod-deletion-cost annotation is the only knob, shifting the pool's total_disruption_cost denominator and pushing the consolidation score across the 1/k=0.5 threshold. Approved variant (cost=0) and rejected variant (cost=2e9) run under ConsolidationPolicyBalanced. Each phase writes a paired JSON sidecar via common.WriteLatencySidecar using the common.LatencySidecar shape introduced with LatencyHarness so downstream analysis can pair a PerformanceReport with its latency companion. Neither variant asserts an exact karpenter_consolidation_moves_total count; KWOK timing blurs which candidates land in a given round. The soft directional check hasScoreSeriesForDecision only logs when the expected decision series is absent. Signed-off-by: Nathaniel Jones <jonesflp@amazon.com>
…LatencySidecar
Two E2E spec groups in test/suites/performance/:
1. Balanced Churn Chain - 400-pod scale-out followed by three
scale-in / scale-out rounds under each ConsolidationPolicy.
LatencyHarness spans the churn window; report + latency sidecar
are paired on disk for offline diff analysis.
2. Balanced Heterogeneous NodePools - two family-restricted NodePools
('c' and 'm' KWOK families) with distinct pod-density profiles.
Scale-down triggers cross-pool consolidation; per-pool decisions
are captured via the same paired-artifact scheme.
Consumes common.LatencySidecar + common.WriteLatencySidecar (added in
750de8d) instead of the file-local named type + inline writer.
Package-scoped constants scaleAndSettleWaitFactor and
suiteConsolidateAfter replace the 90s magic-number sleep in
scaleAndSettle.
Signed-off-by: Nathaniel Jones <jonesflp@amazon.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: nathangeology The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #N/A
Description
Adds end-to-end performance specs for the
Balancedconsolidation policy landed in #2962. The specs provide regression coverage for score-driven consolidation decisions on top of the existingbasicandwideDeploymentssuites.Three artifacts are added under
test/:LatencyHarness+LatencySidecar(intest/pkg/environment/common/) is the shared substrate.LatencyHarnessscrapes Karpenter's/metricsat phase start and stop and reduces per-series histogram bucket deltas into percentile stats (P50 / P90 / P95 / P99 plus a bucket-truncation rate) and counter deltas over the observation window.LatencySidecaris the on-disk JSON schema written alongsidePerformanceReportwhenOUTPUT_DIRis set. Both are consumed by the new specs so aPerformanceReportand its latency companion pair on disk for offline diff analysis.test/suites/performance/balanced_baseline_marginal_test.gocovers two specs.Balanced Baseline Itreuses the 1000-pod / 700-pod fixture frombasic_test.go, wrapped with the harness so hero histograms (scheduling_decision,voluntary_disruption_decision_evaluation,pods_bound) are captured for both scale-out and consolidation phases. This is the reference distribution the marginal runs compare against; suite-wideWhenEmptyOrUnderutilizedapplies.Balanced Marginal Moveruns two variants that share the same fixture. The small deployment'spod-deletion-costannotation is the only knob and shifts the pool's total_disruption_cost denominator to push the consolidation score across the1/k=0.5threshold. Approved variant runs atcost=0; rejected variant runs atcost=2e9. Both run underConsolidationPolicyBalanced.test/suites/performance/balanced_churn_heterogeneous_test.gocovers churn-chain and heterogeneous NodePool scenarios. The churn-chain spec drives a 400-pod scale-out followed by three scale-in / scale-out rounds under eachConsolidationPolicy; the harness spans the churn window. The heterogeneous spec runs two family-restricted NodePools (KWOKcandmfamilies) with distinct pod-density profiles and observes cross-pool consolidation on scale-down. Per-pool decisions are captured via the same paired-artifact scheme.The paired-run pattern (
WhenEmptyOrUnderutilizedfirst, thenBalanced) keeps the second run starting from an AfterEach-clean state so diff analysis stays stable. Neither variant asserts an exactkarpenter_consolidation_moves_totalcount; KWOK timing blurs which candidates land in a given round, so the soft directional checkhasScoreSeriesForDecisiononly logs when the expected decision series is absent.Provider-specific threshold overrides continue to work through the
KARPENTER_PERF_THRESHOLDSenv var from #3165. The threshold-lift companion for the existingbasicandwideDeploymentssuites is in #3245.How was this change tested?
make verifypasses locally.make presubmitpasses includingvulncheck. Compile is clean undergo test -c ./test/suites/performance/...and unit tests in./test/pkg/environment/common/...pass. The e2e specs themselves cannot be exercised outside the kind-perf-e2e workflow; fork CI will verify that path after push. Threshold values (for the new specs) were chosen with headroom over observed samples rather than from a full re-baseline capture; the rationale for the accompanying threshold-lift on the pre-existing suites is in #3245.AI Disclosure
I used an LLM to parallel program with me on this. That included drafting the PR description, running the rebase against upstream/main, and the three small cleanup refactors (histogram reducer complexity, LatencySidecar hoist, and magic-number naming). All benchmark spec logic was authored by me previously; the LLM did not write the perf spec bodies.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.